package com.example;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicStampedReference;

/**
 * 线程测试类
 * @author xiaohf
 * @createTime 2021/10/23 19:39
 **/
public class ThreadTest {
    public static void main(String[] args) {
        //两种线程使用方式
        ThreadRunnable threadRunnable = new ThreadRunnable();
        ThreadThread threadThread = new ThreadThread();
        threadRunnable.run();
        threadThread.start();

        Thread thread = new Thread(() -> {
            System.out.println(1);
        });
        AtomicInteger atomicInteger = new AtomicInteger(1);
        atomicInteger.decrementAndGet();
        thread.start();


    }
}

class ThreadRunnable implements Runnable {

    @Override
    public void run() {
        System.out.println("ThreadRunnable:"+"run");
    }
}


class ThreadThread extends Thread {
    @Override
    public void run() {
        System.out.println("ThreadThread:"+"run");
    }
}
